# == ceph::key
#
# Ceph Auth key
#
define ceph::key (
  $key,
  $auid  = undef,
  $mon   = undef,
  $mds   = undef,
  $osd   = undef,
  $path  = undef,
  $owner = 'root',
  $group = 'root',
  $mode  = '0600',
) {
  if $path {
    $keypath = $path
  } else {
    if $name =~ /\.$/ {
      $keypath = "/etc/ceph/ceph.${name}keyring"
    } else {
      $keypath = "/etc/ceph/ceph.${name}.keyring"
    }
  }

  file { $keypath:
    owner   => $owner,
    group   => $group,
    mode    => $mode,
    content => template('ceph/key.erb'),
  }
}
